/* include/kernel/elf.h 
 * 
 * This file is part of xnix. 
 * 
 * XNIX is free software: you can redistribute it and/or modify 
 * it under the terms of the GNU General Public License as published by 
 * the Free Software Foundation, either version 3 of the License, or 
 * (at your option) any later version. 
 * 
 * XNIX is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
 * GNU General Public License for more details. 
 * 
 * You should have received a copy of the GNU General Public License 
 * along with XNIX. If not, see <https://www.gnu.org/licenses/>
 */ 




#ifndef __ELF_H
#define __ELF_H


#ifndef __ASSEMBLER__

#include <sys/types.h>


struct elf_header {
/* 0x7f, 'E', 'L', 'F' */

	char magic[4];

	char mbits;
	char endian;
	char version;
	char os_abi;

	char pad[8];

	__uint16_t obj_type;
	__uint16_t machine;

	__uint32_t elf_ver;

	__uint64_t entry;
	__uint64_t phd_off;
	__uint64_t shd_off;

	__uint32_t flags;
	__uint16_t ehd_size;

	__uint16_t phent_size;
	__uint16_t nrph;

	__uint16_t shent_size;
	__uint16_t nrsh;

	__uint16_t shstrindex;
} __attribute__ ((packed));


#endif

#define ELF_32		1
#define ELF_64 		2

#define ELF_LENDIAN 	1
#define ELF_BENDIAN 	2

#define ELF_ABI_SYSV 	0

#define ELF_RELOC 	1
#define ELF_EXEC 	2
#define ELF_SHARING 	3
#define ELF_CORE 	4


#endif

